import { Route } from "react-router-dom"
import React from "react"

/**
 * 
 * @param {Object} route 一个路由配置对象，这个对象包含了path component 等属性
 */
const ComponentSub = (route) => {
    let Ay=null
    try {
      if(route.component().then){
        Ay=React.lazy(route.component)
      }
    } catch (e) {
        // console.log(e)
    }
   Ay=Ay? Ay:route.component
    return (<Route path={route.path} render={(props) => <Ay {...props} routes={route.routes}></Ay>}></Route>)
    // return <h1>备用的组件</h1>
}
export default ComponentSub